entry: Hide popover when touching elsewhere
authorMatthias Clasen <mclasen@redhat.com>
Mon, 8 Jun 2015 00:41:16 +0000 (20:41 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 8 Jun 2015 10:56:12 +0000 (06:56 -0400)
Otherwise, the popover becomes 'sticky' and hard-to-dismiss.

gtk/gtkentry.c

index de4ec31e77ab1229b16abeef1d9db70357a823d9..14328aca4980c15c2a2650a38933ee9168c1d196 100644 (file)
@@ -4506,24 +4506,29 @@ gtk_entry_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
                   priv->drag_start_y = y;
                }
             }
-          else if (!extend_selection)
-            {
-              gtk_editable_set_position (editable, tmp_pos);
-            }
           else
             {
-              gtk_entry_reset_im_context (entry);
-
-              if (!have_selection) /* select from the current position to the clicked position */
-                sel_start = sel_end = priv->current_pos;
+              gtk_entry_selection_bubble_popup_unset (entry);
 
-              if (tmp_pos > sel_start && tmp_pos < sel_end)
+              if (!extend_selection)
                 {
-                  /* Truncate current selection, but keep it as big as possible */
-                  if (tmp_pos - sel_start > sel_end - tmp_pos)
-                            gtk_entry_set_positions (entry, sel_start, tmp_pos);
-                  else
-                            gtk_entry_set_positions (entry, tmp_pos, sel_end);
+                  gtk_editable_set_position (editable, tmp_pos);
+                }
+              else
+                {
+                  gtk_entry_reset_im_context (entry);
+
+                  if (!have_selection) /* select from the current position to the clicked position */
+                    sel_start = sel_end = priv->current_pos;
+
+                  if (tmp_pos > sel_start && tmp_pos < sel_end)
+                    {
+                      /* Truncate current selection, but keep it as big as possible */
+                      if (tmp_pos - sel_start > sel_end - tmp_pos)
+                        gtk_entry_set_positions (entry, sel_start, tmp_pos);
+                      else
+                        gtk_entry_set_positions (entry, tmp_pos, sel_end);
+                    }
                 }
             }